package com.cardbaobao.cardbabyclient.utils;

import com.cardbaobao.cardbabyclient.BuildConfig;
import com.cardbaobao.cardbabyclient.base.Constant;

/**
 * 接口请求
 * Created by zad
 * 2016/12/7 10:44
 */

public class URLUtil {
    /**
     * 开发环境
     **/
    private final static String[] DebugUrlConfig = {
//开发
//            "http://192.168.1.81:8091",//app项目
//            "http://192.168.1.81:8080",//图片
//            "http://192.168.1.81:8082",//web
//            "http://192.168.1.80:8080",社保公积金授权
//            "http://172.18.1.40:8080"//数据埋点

            //beta1
//            "http://192.168.1.21:8091",//app项目
//            "http://192.168.1.78:8090",//图片
//            "http://192.168.1.21:8082",//web
//            "http://192.168.1.80:8080",//社保公积金授权
//            "http://172.18.1.40:8080"//数据埋点

            //beta2
//            "http://192.168.1.22:8091",//app项目
//            "http://192.168.1.78:8080",//图片
//            "http://192.168.1.22:8082",//web
//            "http://192.168.1.80:8080",//社保公积金授权
//            "http://172.18.1.40:8080"//数据埋点

            //灰度
//            "http://api1.cardbaobao.com",//app项目
//            "http://10.0.1.121:8090",//图片
//            "http://10.0.1.121:8080",//m站
//            "http://192.168.1.80:8080",//社保、公积金授权
//            "http://172.18.1.40:8080"//数据埋点

            //线上
            "https://api.cardbaobao.com",//app项目
            "https://img.cardbaobao.com",//图片
            "https://m.cardbaobao.com",//m站
            "http://120.77.249.111:8080",//社保、公积金授权
            "http://event.cardbaobao.com"//数据埋点

    };

    /**
     * 测试环境1，给到测试进行测试
     */
    private static final String[] Beta1UrlConfig = {
            "http://192.168.1.21:8091",//app项目
            "http://192.168.1.78:8090",//图片
            "http://192.168.1.21:8082",//web
            "http://192.168.1.80:8080",//社保公积金授权
            "http://172.18.1.40:8080",//数据埋点
    };

    /**
     * 测试环境2，给到测试进行测试
     */
    private static final String[] Beta2UrlConfig = {
            "http://192.168.1.22:8091",//app项目
            "http://192.168.1.78:8080",//图片
            "http://192.168.1.22:8082",//web
            "http://192.168.1.80:8080",//社保公积金授权
            "http://172.18.1.40:8080",//数据埋点
    };

    /**
     * 灰度环境
     */
    private static final String[] GrayUrlConfig = {
            "http://api1.cardbaobao.com",//app项目
            "http://img.cardbaobao.com",//图片
            "http://mgray.cardbaobao.com",//m站
            "http://192.168.1.80:8080",//社保、公积金授权
            "http://172.18.1.40:8080",//数据埋点
    };

    /**
     * 生产环境
     */
    private final static String[] ReleaseUrlConfig = {
            "https://api.cardbaobao.com",//app项目
            "https://img.cardbaobao.com",//图片
            "https://m.cardbaobao.com",//m站
            "http://120.77.249.111:8080",//社保、公积金授权
            "http://event.cardbaobao.com",//数据埋点
    };

    private static String[] getUrlConfig() {
        if (BuildConfig.BUILD_TYPE.equals(Constant.PRODUCT_ENVIRONMENT)) {
            return ReleaseUrlConfig;
        }
        switch (SharedPreferencesUtil.ConfigInfo.getApiAddressType()){
            case 1:
                return Beta1UrlConfig;
            case 2:
                return Beta2UrlConfig;
            case 3:
                return GrayUrlConfig;
            case 4:
                return ReleaseUrlConfig;
            default:
                return DebugUrlConfig;
        }
    }

    /**
     * 测试接口访问主页 INDEX URL
     */
    private static final String CBB_HTTP_URL = getUrlConfig()[0];
    /**
     * 图片地址前缀
     */
    public static final String CBB_IMG_URL = getUrlConfig()[1];
    /**
     * webView网页地址
     */
    public static final String CBB_WEB_URL = getUrlConfig()[2];
    /**
     * 社保、公积金授权地址
     */
    private static final String CBB_AUTH_URL = getUrlConfig()[3];
    /**
     * 数据埋点地址
     */
    private static final String CBB_BURIED_URL = getUrlConfig()[4];

    /**
     * 轮播图接口 公共
     */
    public static final String BANNER_PIC = CBB_HTTP_URL + "/app/common/getCarouselFigure.do";
    /**
     * 分类业务TAB接口 公共
     */
    public static final String BUSINESS_CLASS = CBB_HTTP_URL + "/app/common/tab";
    /**
     * 首页Tab页接口
     */
    public static final String HOME_TAB = CBB_HTTP_URL + "/app/home/getHomeTabManagerAll.do";
    /**
     * 极速办卡列表接口
     */
    public static final String SPEED_CARD = CBB_HTTP_URL + "/card/getSpeedCardList.do";
    /**
     * 极速办卡标签页
     */
    public static final String SPEED_CARD_TAG = CBB_HTTP_URL + "/card/getSpeedCardTag.do";
    /**
     * 信用卡首页接口
     */
    public static final String CREDIT_CARD_INDEX = CBB_HTTP_URL + "/card/index.do";
    /**
     * 办卡攻略首页接口
     */
    public static final String CREDIT_CARD_RAIDERS_INDEX = CBB_HTTP_URL + "/cardStrategyApi/index.do";
    /**
     * 办卡攻略列表接口
     */
    public static final String CREDIT_CARD_RAIDERS = CBB_HTTP_URL + "/cardStrategyApi/getPageList.do";
    /**
     * 办卡攻略顶部标签
     */
    public static final String CREDIT_CARD_RAIDERS_TOP_LABLE = CBB_HTTP_URL + "/cardStrategyApi/strategyMenu.do";
    /**
     * 新手办卡
     */
    public static final String NOVICE_CREDIT_CARD = CBB_HTTP_URL + "/card/cardNovice.do";
    /**
     * 热门活动
     */
    public static final String HOT_ACTIVITIES = CBB_HTTP_URL + "/hotEventsApi/hotEventList.do";
    /**
     * 贷款首页接口
     */
    public static final String LOAN_INDEX = CBB_HTTP_URL + "/app/loans/home";
    /**
     * 贷款筛选分类接口
     */
    public static final String LOAN_POP_DATA = CBB_HTTP_URL + "/app/loans/nav";
    /**
     * 贷款人群分类列表接口
     */
    public static final String LOAN_LIST_DATA = CBB_HTTP_URL + "/app/loans/product";
    /**
     * 产品列表、极速贷款数据接口
     */
    public static final String SPEED_OR_PRODUCT = CBB_HTTP_URL + "/app/loans/product/order";
    /**
     * 每日红包
     */
    public static final String DAILY_RED_ENVELOPES = CBB_HTTP_URL + "/loans/loansRedPacket.do";
    /**
     * 头部公共模块接口
     */
    public static final String HEAD_COMMON = CBB_HTTP_URL + "/app/common/getHeadCommonModule.do";
    /**
     * 办卡进度查询银行列表
     */
    public static final String CREDIT_CARD_BANK_LIST = CBB_HTTP_URL + "/app/getBnakJDList";
    /**
     * 我的收藏-信用卡
     */
    public static final String MY_COLLECT_CARD = CBB_HTTP_URL + "/app/getCreditCardFavorites.do";
    /**
     * 我的收藏-贷款
     */
    public static final String MY_COLLECT_LOAN = CBB_HTTP_URL + "/app/getLoansFavorites.do";
    /**
     * 贷款申请记录列表接口
     */
    public static final String LOANS_APPLY_RECORD = CBB_HTTP_URL + "/muster/getOrderApplyLoansList.do";
    /**
     * 我的消息 列表
     */
    public static final String MY_MESSAGE_LIST = CBB_HTTP_URL + "/muster/getInformationPush.do";
    /**
     * 提交红包申请记录
     */
    public static final String COMMIT_RED_ENVELOPES_RECORD = CBB_HTTP_URL + "/loans/updateRedPacket.do";
    /**
     * 学信网授权前置步骤
     */
    public static final String PRE_CHSI_AUTH = CBB_AUTH_URL + "/xuexin/xuexin";
    /**
     * 学信网授权[爬取学历信息]
     */
    public static final String CHSI_AUTH = CBB_AUTH_URL + "/xuexin/xuexincraw";
    /**
     * 登录
     */
    public static final String LOGIN = CBB_HTTP_URL + "/member/checkAccountLogin.do";
    /**
     * 用户信息
     */
    public static final String MEMBER_INFO = CBB_HTTP_URL + "/muster/getMemberInfo.do";
    /**
     * 公积金、社保城市列表
     */
    public static final String AUTH_CITY_LIST = CBB_AUTH_URL + "/sbandgjj/getzone";
    /**
     * 获取登录要素
     */
    public static final String LOGIN_ELEMENTS = CBB_AUTH_URL + "/sbandgjj/getloginelement";
    /**
     * 创建任务
     */
    public static final String CREATE_TASK = CBB_AUTH_URL + "/sbandgjj/createtask";
    /**
     * 任务爬取
     */
    public static final String TASK_CRAWLING = CBB_AUTH_URL + "/sbandgjj/startcrawl";
    /**
     * 带验证码的任务爬取
     */
    public static final String TASK_CRAWLING_WITH_AUTH_CODE = CBB_AUTH_URL + "/sbandgjj/crawlwithcode";
    /**
     * 刷新验证码
     */
    public static final String REFRESH_AUTH_CODE = CBB_AUTH_URL + "/sbandgjj/resendcode";
    /**
     * 更新用户昵称
     */
    public static final String UPDATE_USER_NICK_NAME = CBB_HTTP_URL + "/member/updateMemberByID.do";
    /**
     * 更新用户头像
     */
    public static final String UPDATE_USER_AVATAR = CBB_HTTP_URL + "/images/up/AppImagesUpload";
    /**
     * 申请信用卡城市列表
     */
    public static final String APPLY_CREDIT_CARD_CITY_LIST = CBB_HTTP_URL + "/app/getCardApplyCityList.do";
    /**
     * 所有城市[申请贷款]城市列表
     */
    public static final String FULL_CITY_LIST = CBB_HTTP_URL + "/app/getCityList.do";
    /**
     * 信用卡详情顶部数据
     */
    public static final String CREDIT_CARD_DETAIL_TOP = CBB_HTTP_URL + "/creditcard/getCreditCardDetails.do";

    /**
     * 猜你喜欢信用卡列表
     */
    public static final String CREDIT_CARD_DETAIL_GUESS_LIKE = CBB_HTTP_URL + "/creditcard/getSuitForYouCardLists.do";
    /**
     * 贷款详情
     */
    public static final String LOAN_DETAIL = CBB_HTTP_URL + "/app/getProductLoansDetails.do";
    /**
     * 信用变钱首页接口
     */
    public static final String CREDIT_TO_CASH_INDEX = CBB_HTTP_URL + "/muster/getCreditOfmoney.do";
    /**
     * 授权状态
     */
    public static final String AUTH_STATUS = CBB_AUTH_URL + "/sbandgjj/authresult";
    /**
     * 反馈意见
     */
    public static final String FEEDBACK = CBB_HTTP_URL + "/common/AddFeedBack.do";
    /**
     * 重置密码
     */
    public static final String RESET_PASSWORD = CBB_HTTP_URL + "/member/updateNewPassWord.do";
    /**
     * 检查手机号码是否注册
     */
    public static final String CHECK_PHONE_REGISTERED = CBB_HTTP_URL + "/member/checkMobileExist.do";
    /**
     * 发送短信
     */
    public static final String SEND_SMS = CBB_HTTP_URL + "/sms/ajaxsend.do";
    /**
     * 注册
     */
    public static final String REGISTER = CBB_HTTP_URL + "/member/registerMember.do";
    /**
     * 运营商授权创建任务
     */
    public static final String YYS_CREATE_TASK = CBB_AUTH_URL + "/yys/user/task";
    /**
     * 运营商授权
     */
    public static final String YYS_AUTH = CBB_AUTH_URL + "/yys/user/auth";
    /**
     * 运营商授权刷新验证码
     */
    public static final String YYS_REFRESH_AUTH_CODE = CBB_AUTH_URL + "/yys/resendcode";
    /**
     * 修改个人信息
     */
    public static final String UPDATE_PERSON_INFO = CBB_HTTP_URL + "/muster/saveMemberInfo.do";
    /**
     * 查询公积金基础部分
     */
    public static final String PROVIDENT_FUND_BASE = CBB_AUTH_URL + "/sbandgjj/querygjjbaseinfo";
    /**
     * 查询公积金明细
     */
    public static final String PROVIDENT_FUND_DETAIL = CBB_AUTH_URL + "/sbandgjj/querygjjbillpage";
    /**
     * 实名认证
     */
    public static final String REAL_NAME_IDENTIFY = CBB_HTTP_URL + "/verification/getRealNameNew.do";
    /**
     * 查询社保记录
     */
    public static final String SOCIAL_SECURITY_RECORD = CBB_AUTH_URL + "/sbandgjj/queryshebaoresult";
    /**
     * 修改密码
     */
    public static final String MODIFY_PASSWORD = CBB_HTTP_URL + "/member/updatePassWord.do";
    /**
     * 信用卡申请记录
     */
    public static final String CREDIT_CARD_APPLY_RECORD = CBB_HTTP_URL + "/OrderSalesApplyCreditCard/selectMyOrder.do";
    /**
     * 社保、公积金查询结果
     */
    public static final String S_F_QUERY_RESULT = CBB_AUTH_URL + "/sbandgjj/queryresult";
    /**
     * 检查更新包
     */
    public static final String CHECK_UPDATE = CBB_HTTP_URL + "/app/getAppversion.do";
    /**
     * 查询城市信息
     */
    public static final String QUERY_CITY_INFO = CBB_HTTP_URL + "/getDataByCityName.do";
    /**
     * 搜索银行网点
     */
    public static final String BANK_NET_POT = CBB_HTTP_URL + "/app/search.do";
    /**
     * 银行电话列表
     */
    public static final String BANK_TLE_LIST = CBB_HTTP_URL + "/app/getBnakList.do";
    /**
     * 收藏产品
     */
    public static final String COLLECT_PRODUCT = CBB_HTTP_URL + "/app/saveMemberFavorites.do";
    /**
     * 取消收藏
     */
    public static final String UN_COLLECT_PRODUCT = CBB_HTTP_URL + "/app/deleteMemberFavorites";
    /**
     * 根据id获取用户信息
     */
    public static final String USER_INFO = CBB_HTTP_URL + "/member/getMemberById.do";
    /**
     * 快捷收款、二维码收款获取用户绑卡信息
     */
    public static final String CHECK_BIND_CARD = CBB_HTTP_URL + "/app/walletQuickCollection/immediateCollection.do";
    /**
     * 查询卡bin
     */
    public static final String QUERY_CARD_BIN = CBB_HTTP_URL + "/app/wallet/getBankcardBinInfo.do";
    /**
     * 银行列表
     */
    public static final String BANK_LIST_BY_TYPE = CBB_HTTP_URL + "/app/wallet/getBnakList.do";
    /**
     * 绑定储蓄卡
     */
    public static final String BIND_DEBIT_CARD = CBB_HTTP_URL + "/app/walletQuickCollection/bankCardFourFactorsVer.do";
    /**
     * 获取快捷收款 收款费率列表
     */
    public static final String QUICK_DEBIT_FEE_RATE = CBB_HTTP_URL + "/app/walletQuickCollection/cashierDesk.do";
    /**
     * 获取二维码收款 收款费率列表
     */
    public static final String QR_CODE_DEBIT_FEE_RATE = CBB_HTTP_URL + "/app/wallet/geWalletRateList.do";
    /**
     * 判断有没有绑信用卡
     */
    public static final String CHECK_BIND_CREDIT_CARD = CBB_HTTP_URL + "/app/walletQuickCollection/cashierCollection.do";
    /**
     * 绑定信用卡
     */
    public static final String BIND_CREDIT_CARD = CBB_HTTP_URL + "/app/creditCardBind/creditCardFourFactorsVer.do";
    /**
     * 获取用户绑定的银行列表
     */
    public static final String USER_BANK_CARD_LIST = CBB_HTTP_URL + "/app/wallet/getMyBnakCardList.do";
    /**
     * 快捷收款下单
     */
    public static final String QUICK_DEBIT_COMMIT_ORDER = CBB_HTTP_URL + "/app/walletQuickCollection/cashOrder.do";
    /**
     * 快捷收款发送短信
     */
    public static final String QUICK_DEBIT_SMS = CBB_HTTP_URL + "/app/walletQuickCollection/cashOrderSendMsg.do";
    /**
     * 快捷收款确认接口
     */
    public static final String QUICK_DEBIT_ENSURE = CBB_HTTP_URL + "/app/walletQuickCollection/cashOrderConfirm.do";
    /**
     * 交易详情
     */
    public static final String TRANSACTION_DETAIL = CBB_HTTP_URL + "/app/wallet/transactionDetails.do";

    /**
     * 二维码下单接口
     */
    public static final String QR_CODE_DEBIT_ORDER = CBB_HTTP_URL + "/app/wallet/saveCbbWalletOrderByQRCode.do";
    /**
     * 我的交易记录
     */
    public static final String MINE_TRANSACTION_RECORDS = CBB_HTTP_URL + "/app/wallet/getMyOrderList.do";
    /**
     * 解绑储蓄卡
     */
    public static final String UN_BIND_DEBIT_CARD = CBB_HTTP_URL + "/app/wallet/updateDebitCard.do";
    /**
     * 解绑信用卡
     */
    public static final String UN_BIND_CREDIT_CARD = CBB_HTTP_URL + "/app/wallet/updateCreditCard.do";
    /**
     * 信用卡提额
     */
    public static final String UPPER_QUOTA_LIST = CBB_HTTP_URL + "/app/mention/listCreditCardMention.do";
    /**
     * 信用卡还款卡列表
     */
    public static final String CREDIT_REPAYMENT = CBB_HTTP_URL + "/app/repayCreditCardList";
    /**
     * 信用卡还款记录列表
     */
    public static final String CREDIT_REPAYMENT_RECORD = CBB_HTTP_URL + "/app/repaymentRecordsList.do";
    /**
     * 信用卡还款代扣接口
     */
    public static final String CREDIT_REPAYMENT_WITHHOLD = CBB_HTTP_URL + "/app/walletCreditCardPayment/withholding.do";
    /**
     * 添加信用卡还款卡接口
     */
    public static final String ADD_CREDIT = CBB_HTTP_URL + "/app/addRepayCreditCard.do";
    /**
     * 设置支付密码
     */
    public static final String SET_REPAY_PWD = CBB_HTTP_URL + "/app/walletCreditCardPayment/setUserPaymentPassword.do";
    /**
     * 查询支付密码
     */
    public static final String QUERY_REPAY_PWD = CBB_HTTP_URL + "/app/walletCreditCardPayment/findUserPaymentPassword.do";
    /**
     * 验证支付密码
     */
    public static final String VERIFY_REPAY_PWD = CBB_HTTP_URL + "/app/walletCreditCardPayment/validateUserPaymentPassword.do";
    /**
     * 解除还款卡绑定
     */
    public static final String CREDIT_UNBOUND = CBB_HTTP_URL + "/app/walletCreditCardRepay/relieveCreditCard.do";


    /**
     * 办卡总通道
     */
    public static final String CREDIT_CARD_APPLY_INDEX_URL = CBB_WEB_URL + "/credtCardApplyApp/cardApplyIndex.do";
    /**
     * 快捷收款协议
     */
    public static final String QUICK_DEBIT_AGREEMENT = CBB_WEB_URL + "/html/wallet_quick_collection_service_agreement.html";
    /**
     * 信用卡提额详情
     */
    public static final String UPPER_QUOTA_DETAIL = CBB_WEB_URL + "/mention/details.do?id=";
    /**
     * 申请信用卡 单卡办理URL
     */
    public static final String APPLY_SINGLE_CREDIT = CBB_WEB_URL + "/app/credtCardApplyNewApp/apply/isZong.do";
    /**
     * 申请贷款
     */
    public static final String APPLY_CARD_LOAN = CBB_WEB_URL + "/loansapply/app/form/apply/applyIndex.do";
    /**
     * 消息详情
     */
    public static final String MESSAGE_DETAIL = CBB_WEB_URL + "/app/informationDetail.do?ID=";
    /**
     * 社保授权协议地址
     */
    public static final String SHEBAO_AUTH_AGREEMENT = CBB_WEB_URL + "/html/sbcardgreement.html";
    /**
     * 公积金授权协议地址
     */
    public static final String GONGJIJIN_AUTH_AGREEMENT = CBB_WEB_URL + "/html/gongjijingreement.html";
    /**
     * 学信网、运营商授权协议
     */
    public static final String DATA_PARSER_AGREEMENT = CBB_WEB_URL + "/html/data-parser-agreement.html";
    /**
     * 注册/服务协议
     */
    public static final String REGISTRATION_AGREEMENT = CBB_WEB_URL + "/html/serviceagreement.html";
    /**
     * 关于我们
     */
    public static final String ABOUT_US = CBB_WEB_URL + "/html/aboutus.html";
    /**
     * 分享url
     */
    public static final String SHARE = CBB_WEB_URL + "/others/about/downloadAppByWeChat.do";
    /**
     * 信用卡网页介绍
     */
    public static final String CREDIT_CARD_INTRO = CBB_WEB_URL + "/creditCardApp/creditCardInfo.do";
    /**
     * 贷款网页介绍
     */
    public static final String LOAN_INTRO = CBB_WEB_URL + "/loansForApp/product/details.do";
    /**
     * 常见问题
     */
    public static final String COMMON_QUESTION = CBB_WEB_URL + "/html/wallet_problem.html";
    /**
     * 信用卡还款服务协议
     */
    public static final String REPAYMENT_AGREEMENT = CBB_WEB_URL + "/html/credit_card_repayment_agreement.html";
    /**
     * 信用卡还款服务协议
     */
    public static final String USE_HELP_AGREEMENT = CBB_WEB_URL + "/html/credit_card_repayment_problem.html";


    /**
     * 大数据埋点url
     */
    public static final String DATA_BURIED_URL = CBB_BURIED_URL + "/appAmbushLogger/writeLog.do";
    public static final String TEMPORARY_ID_URL = CBB_BURIED_URL + "/tourist/generateId.do";


    public static final String CASH_LOAN = "http://m.youqianla.cc/Ccbb02/"; //现金贷h5

}
